//
//  SYLTView.m
//  TermOfSectionB
//
//  Created by 韩震明 on 15/11/27.
//  Copyright © 2015年 韩震明. All rights reserved.
//

#import "SYLTView.h"

@implementation SYLTView

- (instancetype)initWithFrame:(CGRect)frame
{
    self = [super initWithFrame:frame];
    if (self) {
        [self createLTView];
    }
    return self;
}

- (void)createLTView
{
    
    self.myLabel = [[UILabel alloc] init/*WithFrame:CGRectMake(20, 20, 100, 50)*/];
    [self addSubview:self.myLabel];
    self.myLabel.layer.borderWidth = 1;
    self.myLabel.layer.cornerRadius = 5;
    self.myLabel.textAlignment = NSTextAlignmentCenter;
    
    
    self.myTextField = [[UITextField alloc] init/*WithFrame:CGRectMake(150, 20, 100, 50)*/];
    [self addSubview:self.myTextField];
    self.myTextField.layer.borderWidth = 1;
    self.myTextField.layer.cornerRadius = 5;
    self.myTextField.textAlignment = NSTextAlignmentCenter;
    
    
}

- (void)layoutSubviews
{
    [self.myLabel mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.equalTo(self);
        make.left.equalTo(self);
        make.right.equalTo(self.myTextField.mas_left).with.offset(- 15);
        make.bottom.equalTo(self);
        make.width.equalTo(self.myTextField);
        
    }];
    
    [self.myTextField mas_makeConstraints:^(MASConstraintMaker *make) {
        make.top.right.bottom.equalTo(self);
        
    }];
}

@end
